<!-- eslint-disable -->
<template>
  <div>
    <!-- <navbar title="投保方案" :disabled="true"></navbar> -->
    <div style="position:relative;top:46px;    margin-bottom: 65px;">
      <van-checkbox-group v-model="zanCun" style=" display:none;">
        <van-cell-group>
          <van-cell v-for="item in list" clickable :key="item" :title="'已有投保单'" @click="ccc">
            <van-checkbox :name="item" ref="checkboxes"/>
          </van-cell>

          <van-field
            v-show="zanCun[0]=='1'"
            v-model="touNum"
            label="投保单号"
            type="textarea"
            placeholder
            rows="1"
            autosize
          />
        </van-cell-group>
      </van-checkbox-group>
      <div class="P_title">
        <!-- <div style="padding:0.2rem ;     font-size: 0.35rem;">交强险:</div> -->
        <van-cell-group>
          <van-cell>
            <template slot="title">
              <span class="van-cell-text cell_title">交强险</span>
              <!-- <span class="van-cell-text" style="position:absolute; left :5.5rem; "><van-checkbox v-model="checkbox1" @change="getDaHo" id="zzz">即时生效</van-checkbox></span> -->
              <div class="swich">
                <van-switch v-model="radio" size="20px"/>
              </div>
              <!-- <span class="van-cell-text" style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;" @click="showPo1(1)">{{radio == '1'? "投保":"不投保"}}</span> -->
            </template>
          </van-cell>

          <van-cell
            class="ani_h"
            :style="radio? 'height:44px;padding:10px 15px;':'height:0;padding:0px 15px;'"
            @click="showDatePop"
          >
            <!-- v-show="checkbox1" -->
            <template slot="title">
              <span class="van-cell-text cell_title">起保日期</span>
              <span
                class="van-cell-text"
                style="position:absolute; left :5.5rem; "
              >{{shangDate}}</span>
              <!-- {{jishidate}} {{jishiHour}} -->
              <span
                class="van-cell-text"
                style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
              ></span>
            </template>
          </van-cell>
        </van-cell-group>
      </div>
       <van-popup v-model="showDate" position="bottom" style="width: 10rem;" :overlay="true" class="pop">
         <!-- <van-datetime-picker
            v-model="currentDate"
            type="datetime"
            :min-date="minDate"
            :max-date="maxDate"
             @confirm='confirmA'
          /> -->
          <van-datetime-picker
            v-model="currentDate"
            type="date"
            :min-date="minDate"
             :max-date="maxDate"
            @confirm='confirmA'
          />
      </van-popup> 
      <div>
        <!-- <div style="padding:0.2rem ;    font-size: 0.35rem;">商业险:</div> -->
        <van-cell-group class="P_title">
          <van-cell>
            <template slot="title">
              <span class="van-cell-text cell_title">商业险</span>
              <div class="swich">
                <van-switch v-model="radio2" size="20px"/>
              </div>
              <!-- <span class="van-cell-text" style="position:absolute; left :5.5rem; "><van-checkbox v-model="checkbox2" @change="getDaHo" id="zzz">即时生效</van-checkbox></span> -->
              <!-- <span class="van-cell-text" style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;" @click="showPo1(2)">{{radio2 == '1'? "投保":"不投保"}}</span> -->
            </template>
          </van-cell>

          <van-cell
            class="ani_h"
            :style="radio2? 'height:44px;padding:10px 15px;':'height:0;padding:0 15px;'"
             @click="showDatePop2"
              @confirm='confirmB'
          >
            <!-- v-show="checkbox2" -->
            <template slot="title">
              <span class="van-cell-text cell_title">起保日期</span>
              <span
                class="van-cell-text"
                style="position:absolute; left :5.5rem; "
              >{{jiaoDate}}</span>
              <span
                class="van-cell-text"
                style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
              ></span>
            </template>
          </van-cell>
        </van-cell-group>
        <van-popup v-model="showDate2" position="bottom" style="width: 10rem;" :overlay="true" class="pop">
           <van-datetime-picker
            v-model="currentDate"
            type="date"
            :min-date="minDate"
             :max-date="maxDate"
            @confirm='confirmB'
          />
      </van-popup> 
        <div class="ani_h" :style="radio2? ' max-height:600px;':'max-height:0px'">
          <div class="shangye_child" style="transition:none;">商业险主险</div>
          <van-cell-group>
            <van-cell is-link>
              <template slot="title">
                <span class="van-cell-text cell_title">车辆损失险</span>
                <!-- <van-checkbox v-model="checkbox3" v-show="radio3=='1'" id="zzz"></van-checkbox>  -->
                <span
                  class="van-cell-text mianpei"
                  v-model="checkbox3"
                  :class="checkbox3?'active_m':''"
                  v-show="radio3=='1'"
                  id="zzz"
                  @click="mianpei(3)"
                >不计免赔</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  @click="showPo1(3)"
                >{{radio3 == '1'? "投保":"不投保"}}</span>
              </template>
            </van-cell>
            <van-cell is-link>
              <template slot="title">
                <span class="van-cell-text cell_title">第三者责任险</span>
                <!-- <span class="van-cell-text mianpei" ><van-checkbox v-model="checkbox4"   v-show="radio4!='8'" id="zzz">不计免赔</van-checkbox></span> -->
                <span
                  class="van-cell-text mianpei"
                  v-model="checkbox4"
                  :class="checkbox4?'active_m':''"
                  v-show="radio4=='1'"
                  id="zzz"
                  @click="mianpei(4)"
                >不计免赔</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-if="radio4=='1'"
                  @click="showPo1(4)"
                >5万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='2'"
                  @click="showPo1(4)"
                >10万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='3'"
                  @click="showPo1(4)"
                >15万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='4'"
                  @click="showPo1(4)"
                >20万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='5'"
                  @click="showPo1(4)"
                >30万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='6'"
                  @click="showPo1(4)"
                >50万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='7'"
                  @click="showPo1(4)"
                >100万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio4=='8'"
                  @click="showPo1(4)"
                >不投保</span>
              </template>
            </van-cell>
            <van-cell is-link>
              <template slot="title">
                <span class="van-cell-text cell_title">司机座位责任险</span>
                <!-- <span class="van-cell-text mianpei"><van-checkbox v-model="checkbox5"  v-show="radio5!='11'" id="zzz">不计免赔</van-checkbox></span> -->
                <span
                  class="van-cell-text mianpei"
                  v-model="checkbox5"
                  :class="checkbox5?'active_m':''"
                  v-show="radio5=='1'"
                  id="zzz"
                  @click="mianpei(5)"
                >不计免赔</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-if="radio5=='1'"
                  @click="showPo1(5)"
                >1万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='2'"
                  @click="showPo1(5)"
                >2万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='3'"
                  @click="showPo1(5)"
                >3万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='4'"
                  @click="showPo1(5)"
                >4万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='5'"
                  @click="showPo1(5)"
                >5万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='6'"
                  @click="showPo1(5)"
                >6万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='7'"
                  @click="showPo1(5)"
                >7万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='8'"
                  @click="showPo1(5)"
                >8万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='9'"
                  @click="showPo1(5)"
                >9万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='10'"
                  @click="showPo1(5)"
                >10万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio5=='11'"
                  @click="showPo1(5)"
                >不投保</span>
              </template>
            </van-cell>
            <van-cell is-link>
              <template slot="title">
                <span class="van-cell-text cell_title">乘客座位责任险</span>
                <!-- <span class="van-cell-text mianpei" ><van-checkbox v-model="checkbox6" v-show="radio6!='11'" id="zzz">不计免赔</van-checkbox></span> -->
                <span
                  class="van-cell-text mianpei"
                  v-model="checkbox6"
                  :class="checkbox6?'active_m':''"
                  v-show="radio6=='1'"
                  id="zzz"
                  @click="mianpei(6)"
                >不计免赔</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-if="radio6=='1'"
                  @click="showPo1(6)"
                >1万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='2'"
                  @click="showPo1(6)"
                >2万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='3'"
                  @click="showPo1(6)"
                >3万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='4'"
                  @click="showPo1(6)"
                >4万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='5'"
                  @click="showPo1(6)"
                >5万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='6'"
                  @click="showPo1(6)"
                >6万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='7'"
                  @click="showPo1(6)"
                >7万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='8'"
                  @click="showPo1(6)"
                >8万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='9'"
                  @click="showPo1(6)"
                >9万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='10'"
                  @click="showPo1(6)"
                >10万</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  v-else-if="radio6=='11'"
                  @click="showPo1(6)"
                >不投保</span>
              </template>
            </van-cell>
            <van-cell is-link>
              <template slot="title">
                <span class="van-cell-text cell_title">全车盗抢险</span>
                <span
                  class="van-cell-text"
                  style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                  @click="showPo1(7)"
                >{{radio7 == '1'? "投保":"不投保"}}</span>
              </template>
            </van-cell>
          </van-cell-group>

          <div
            class="shangye_child c_de ani_h"
            :style="radio3=='1'?'max-height:250px;':'max-height:0px;padding:0 0.2rem;'"
          >
            <div style="transition:none;">商业险附加险</div>
            <van-cell-group>
              <van-cell is-link>
                <template slot="title">
                  <span class="van-cell-text cell_title">玻璃单独破碎险</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    v-if="radio8 == '1'"
                    @click="showPo1(8)"
                  >国产玻璃</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    v-else-if="radio8 == '2'"
                    @click="showPo1(8)"
                  >进口玻璃</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    v-else-if="radio8 == '3'"
                    @click="showPo1(8)"
                  >不投保</span>
                </template>
              </van-cell>

              <van-cell is-link>
                <template slot="title">
                  <span class="van-cell-text cell_title">车身划痕险</span>
                  <!-- <span class="van-cell-text mianpei" ><van-checkbox v-model="checkbox9" v-if="radio9 == '1'" id="zzz">不计免赔</van-checkbox></span> -->
                  <!-- eslint-disable  -->
                  <span
                    class="van-cell-text mianpei"
                    v-model="checkbox9"
                    :class="checkbox9?'active_m':''"
                    v-show="radio9=='1'"
                    id="zzz"
                    @click="mianpei(9)"
                  >不计免赔</span>
                  <!-- <span class="van-cell-text" style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;" @click="showPo1(9)">{{radio9 == '1'? "投保":"不投保"}}</span> -->
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    v-if="radio9 == '1'"
                    @click="showPo1(9)"
                  >2000</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    v-else-if="radio9 == '2'"
                    @click="showPo1(9)"
                  >5000</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    v-else-if="radio9 == '3'"
                    @click="showPo1(9)"
                  >不投保</span>
                </template>
              </van-cell>
              <van-cell is-link>
                <template slot="title">
                  <span class="van-cell-text cell_title">自燃损失险</span>
                  <!-- <span class="van-cell-text mianpei"><van-checkbox v-model="checkbox10" v-if="radio10 == '1'" id="zzz">不计免赔</van-checkbox></span> -->
                  <span
                    class="van-cell-text mianpei"
                    v-model="checkbox10"
                    :class="checkbox10?'active_m':''"
                    v-show="radio10=='1'"
                    id="zzz"
                    @click="mianpei(10)"
                  >不计免赔</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    @click="showPo1(10)"
                  >{{radio10 == '1'? "投保":"不投保"}}</span>
                </template>
              </van-cell>
              <van-cell is-link>
                <template slot="title">
                  <span class="van-cell-text cell_title">无第三方特约险</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    @click="showPo1(11)"
                  >{{radio11 == '1'? "投保":"不投保"}}</span>
                </template>
              </van-cell>
              <van-cell is-link>
                <template slot="title">
                  <span class="van-cell-text cell_title">指定专修厂险</span>
                  <span
                    class="van-cell-text"
                    style="position:absolute;color: rgba(0,0,0,0.5);right:1rem;"
                    @click="showPo1(12)"
                  >{{radio12 == '1'? "投保":"不投保"}}</span>
                </template>
              </van-cell>
            </van-cell-group>
          </div>
        </div>

        <div class="btnCon">
          <van-button size="large" type="default" @click="toBaojia">提交</van-button>
        </div>
        <!-- 弹层 -->
        <!-- 交强险 -->
        <van-popup v-model="show" class="pop">
          <van-radio-group v-model="radio" @change="closePop(1)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>
        <!-- 商业 -->
        <van-popup v-model="show2" class="pop">
          <van-radio-group v-model="radio2" @change="closePop(2)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show3" class="pop">
          <van-radio-group v-model="radio3" @change="closePop(3)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show4" class="pop">
          <van-radio-group v-model="radio4" @change="closePop(4)">
            <van-radio name="1" class="popMs">5万</van-radio>
            <van-radio name="2" class="popMs">10万</van-radio>
            <van-radio name="3" class="popMs">15万</van-radio>
            <van-radio name="4" class="popMs">20万</van-radio>
            <van-radio name="5" class="popMs">30万</van-radio>
            <van-radio name="6" class="popMs">50万</van-radio>
            <van-radio name="7" class="popMs">100万</van-radio>
            <van-radio name="8" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show5" class="pop">
          <van-radio-group v-model="radio5" @change="closePop(5)">
            <van-radio name="1" class="popMs">1万</van-radio>
            <van-radio name="2" class="popMs">2万</van-radio>
            <van-radio name="3" class="popMs">3万</van-radio>
            <van-radio name="4" class="popMs">4万</van-radio>
            <van-radio name="5" class="popMs">5万</van-radio>
            <van-radio name="6" class="popMs">6万</van-radio>
            <van-radio name="7" class="popMs">7万</van-radio>
            <van-radio name="8" class="popMs">8万</van-radio>
            <van-radio name="9" class="popMs">9万</van-radio>
            <van-radio name="10" class="popMs">10万</van-radio>
            <van-radio name="11" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show6" class="pop">
          <van-radio-group v-model="radio6" @change="closePop(6)">
            <van-radio name="1" class="popMs">1万</van-radio>
            <van-radio name="2" class="popMs">2万</van-radio>
            <van-radio name="3" class="popMs">3万</van-radio>
            <van-radio name="4" class="popMs">4万</van-radio>
            <van-radio name="5" class="popMs">5万</van-radio>
            <van-radio name="6" class="popMs">6万</van-radio>
            <van-radio name="7" class="popMs">7万</van-radio>
            <van-radio name="8" class="popMs">8万</van-radio>
            <van-radio name="9" class="popMs">9万</van-radio>
            <van-radio name="10" class="popMs">10万</van-radio>
            <van-radio name="11" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show7" class="pop">
          <van-radio-group v-model="radio7" @change="closePop(7)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show8" class="pop">
          <van-radio-group v-model="radio8" @change="closePop(8)">
            <van-radio name="1" class="popMs">国产玻璃</van-radio>
            <van-radio name="2" class="popMs">进口玻璃</van-radio>
            <van-radio name="3" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>

        <van-popup v-model="show9" class="pop">
          <van-radio-group v-model="radio9" @change="closePop(9)">
            <van-radio name="1" class="popMs">2000</van-radio>
            <van-radio name="2" class="popMs">5000</van-radio>
            <van-radio name="3" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>
        <van-popup v-model="show10" class="pop">
          <van-radio-group v-model="radio10" @change="closePop(10)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>
        <van-popup v-model="show11" class="pop">
          <van-radio-group v-model="radio11" @change="closePop(11)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>
        <van-popup v-model="show12" class="pop">
          <van-radio-group v-model="radio12" @change="closePop(12)">
            <van-radio name="1" class="popMs">投保</van-radio>
            <van-radio name="2" class="popMs">不投保</van-radio>
          </van-radio-group>
        </van-popup>
      </div>
    </div>
  </div>
</template>

<script>
import navbar from "../components/navbar.vue";
import axios from "axios";
import Vue from "vue";
import { Toast, Dialog } from "vant";

Vue.use(Toast, Dialog);
export default {
  components: { navbar },
  data() {
    return {
       minDate: new Date(),
      maxDate: new Date(2019, 10, 1),
      currentDate: new Date(),
      list: ["1"],
      zanCun: [],
      touNum: "",
      cityCode: "",
      Address: "",
      ownerName: "",
      identifyNumber: "",
      mobilePhone: "",
      ownerBirthDay: "",
      licenseDate: "",
      carModelId: "",
      frameNo: "",
      engineNo: "",
      licenseNo: "",
      value: "",

      insureName: "",
      insureIdNum: "",
      insurePhone: "",
      insureAddress: "",
      insureBirthday: "",

      insuredName: "",
      insuredIdNum: "",
      insuredPhone: "",
      insuredAddress: "",
      insuredBirthday: "",
      // 交枪险
      checkbox1: false,
      radio: true,
      show: false,
      //投保时间
      jishidate: "",
      jishiHour: "",
      endDate: "",
      endHour: "00:00",

      //商业险
      checkbox2: false,
      radio2: true,
      show2: false,
      //商业险主险
      checkbox3: true,
      checkbox4: true,
      checkbox5: true,
      checkbox6: true,
      checkbox9: true,
      checkbox10: true,

      radio3: "1",
      radio4: "1",
      radio5: "1",
      radio6: "1",
      radio7: "2",
      radio8: "3",
      radio9: "3",
      radio10: "2",
      radio11: "2",
      radio12: "2",

      show3: false,
      show4: false,
      show5: false,
      show6: false,
      show7: false,
      show8: false,
      show9: false,
      show10: false,
      show11: false,
      show12: false,

      shangyeList: [],
      chgOwnerFlag:'',

      showDate:false,
      showDate2:false,
      shangDate:'',
      jiaoDate:'',
      endDate1:'',
      endDate2:'',
    };
  },
  mounted() {
    console.log(this.formatDay(new Date()));
    this.jishidate = this.formatDay(new Date());
    this.jishiHour = "00:00";
    this.endDate = this.formatYear(new Date());
   
    if (this.$route.query.licenseNo) {
      this.licenseNo = this.$route.query.licenseNo;
    }
    if (this.$route.query.cityCode) {
      this.cityCode = this.$route.query.cityCode;
    }
    if (this.$route.query.Address) {
      this.Address = this.$route.query.Address;
    }
    if (this.$route.query.ownerName) {
      this.ownerName = this.$route.query.ownerName;
    }
    if (this.$route.query.identifyNumber) {
      this.identifyNumber = this.$route.query.identifyNumber;
    }
    if (this.$route.query.mobilePhone) {
      this.mobilePhone = this.$route.query.mobilePhone;
    }
    if (this.$route.query.ownerBirthDay) {
      this.ownerBirthDay = this.$route.query.ownerBirthDay;
    }
    if (this.$route.query.licenseDate) {
      this.licenseDate = this.$route.query.licenseDate;
    }
    if (this.$route.query.carModelId) {
      this.carModelId = this.$route.query.carModelId;
    }
    if (this.$route.query.frameNo) {
      this.frameNo = this.$route.query.frameNo;
    }
    if (this.$route.query.engineNo) {
      this.engineNo = this.$route.query.engineNo;
    }
    if (this.$route.query.value) {
      this.value = this.$route.query.value;
    }

    if (this.$route.query.insureName) {
      this.insureName = this.$route.query.insureName;
    }
    if (this.$route.query.insureIdNum) {
      this.insureIdNum = this.$route.query.insureIdNum;
    }
    if (this.$route.query.insurePhone) {
      this.insurePhone = this.$route.query.insurePhone;
    }
    if (this.$route.query.insureAddress) {
      this.insureAddress = this.$route.query.insureAddress;
    }
    if (this.$route.query.insureBirthday) {
      this.insureBirthday = this.$route.query.insureBirthday;
    }

    if (this.$route.query.insuredName) {
      this.insuredName = this.$route.query.insuredName;
    }
    if (this.$route.query.insuredIdNum) {
      this.insuredIdNum = this.$route.query.insuredIdNum;
    }
    if (this.$route.query.insuredPhone) {
      this.insuredPhone = this.$route.query.insuredPhone;
    }
    if (this.$route.query.insuredAddress) {
      this.insuredAddress = this.$route.query.insuredAddress;
    }
    if (this.$route.query.insuredBirthday) {
      this.insuredBirthday = this.$route.query.insuredBirthday;
    }
     if (this.$route.query.chgOwnerFlag) {
      this.chgOwnerFlag = this.$route.query.chgOwnerFlag;
    }
  },
  methods: {
    confirmA: function(data) {
      //   console.log(data);
      //   console.log(this.formatDate(data))
      //   // this.diqu = ;
      this.showDate = false;
      this.shangDate = this.formatDate(data);
      this.endDate1 = this.formatYear(data)
    
        console.log( this.shangDate )
        
     console.log( this.endDate1)
     
    },
    confirmB: function(data) {
      //   console.log(data);
      //   console.log(this.formatDate(data))
      //   // this.diqu = ;
      this.showDate2 = false;
      this.jiaoDate = this.formatDate(data);
       this.endDate2 = this.formatYear(data)
      console.log( this.jiaoDate )
       console.log( this.endDate2)
    },
    showDatePop(){
      if (this.showDate) {
        this.showDate = false;
      } else {
        this.showDate = true;
      }
    },
    showDatePop2(){
       if (this.showDate2) {
        this.showDate2 = false;
      } else {
        this.showDate2 = true;
      }
    },
     formatDate: function(time) {
      var date = new Date(time);

      var year = date.getFullYear(),
        month = date.getMonth() + 1, //月份是从0开始的
        day = date.getDate(),
        hour = date.getHours(),
        min = date.getMinutes(),
        sec = date.getSeconds();
      var newTime =
        year +
        "-" +
        (month < 10 ? "0" + month : month) +
        "-" +
        (day < 10 ? "0" + day : day);

      return newTime;
    },
    
    ccc: function() {
      console.log(this.zanCun.length);
    },
    //报价
    toBaojia: function() {
       if(this.jiaoDate == '' && this.radio == true){
        Toast('请输入交强险起保日期');
        return
      }
      if(this.shangDate == '' && this.radio2 == true){
        Toast('请输入商业险起保日期');
        return
      }

      this.shangyeList = [];
      //险种
      if (this.radio == true && this.radio2 != true) {
        var carInfoSource = "1";
      } else if (this.radio != true && this.radio2 == true) {
        var carInfoSource = "2";
      } else if (this.radio == true && this.radio2 == true) {
        var carInfoSource = "3";
      } else {
        Toast("请选择险种");
      }

      //商业险
      if (this.checkbox3 == true) {
        var c3369003 = "369003";
      } else {
        var c3369003 = "";
      }
      if (this.radio3 == "1") {
        this.shangyeList.push({
          kindCode: "030006",
          sumInsured: null,
          quantity: "",
          unitInsured: "",
          rate: "",
          deductible: "",
          amt: "",
          relatedInd: c3369003,
          glassType: null
        });
      } else {
      }

      //第三者责任险
      if (this.checkbox4 == true && this.radio4 != "8") {
        var c4369003 = "369003";
      } else {
        var c4369003 = "";
      }
      if (this.radio4 != "8") {
        if (this.radio4 == "1") {
          var baofei = "50000";
        }
        if (this.radio4 == "2") {
          var baofei = "100000";
        }
        if (this.radio4 == "3") {
          var baofei = "150000";
        }
        if (this.radio4 == "4") {
          var baofei = "200000";
        }
        if (this.radio4 == "5") {
          var baofei = "300000";
        }
        if (this.radio4 == "6") {
          var baofei = "500000";
        }
        if (this.radio4 == "7") {
          var baofei = "1000000";
        }
        this.shangyeList.push({
          kindCode: "030018",
          sumInsured: baofei,
          quantity: "",
          unitInsured: baofei,
          rate: "",
          deductible: "",
          amt: baofei,
          relatedInd: c4369003,
          glassType: null
        });
      } else {
        var k030018 = "030018";
        var baofei = "";
      }

      //车上人员
      if (this.checkbox5 == true && this.radio5 != "11") {
        var c5369003 = "369003";
      } else {
        var c5369003 = "";
      }
      if (this.radio5 != "11") {
        // var k030001 = '030001'

        if (this.radio5 == "1") {
          var baofei2 = "10000";
        }
        if (this.radio5 == "2") {
          var baofei2 = "20000";
        }
        if (this.radio5 == "3") {
          var baofei2 = "30000";
        }
        if (this.radio5 == "4") {
          var baofei2 = "40000";
        }
        if (this.radio5 == "5") {
          var baofei2 = "50000";
        }
        if (this.radio5 == "6") {
          var baofei2 = "60000";
        }
        if (this.radio5 == "7") {
          var baofei2 = "700000";
        }
        if (this.radio5 == "8") {
          var baofei2 = "800000";
        }
        if (this.radio5 == "9") {
          var baofei2 = "900000";
        }
        if (this.radio5 == "10") {
          var baofei2 = "1000000";
        }
        this.shangyeList.push({
          kindCode: "030001",
          sumInsured: baofei2,
          quantity: "",
          unitInsured: baofei2,
          rate: "",
          deductible: "",
          amt: baofei2,
          relatedInd: c5369003,
          glassType: null
        });
      } else {
        var k030018 = "030001";
        var baofei2 = "";
      }

      if (this.checkbox6 == true && this.radio6 != "11") {
        var c6369003 = "369003";
      } else {
        var c6369003 = "";
      }

      if (this.radio6 != "11") {
        if (this.radio6 == "1") {
          var baofei3 = "10000";
        }
        if (this.radio6 == "2") {
          var baofei3 = "20000";
        }
        if (this.radio6 == "3") {
          var baofei3 = "30000";
        }
        if (this.radio6 == "4") {
          var baofei3 = "40000";
        }
        if (this.radio6 == "5") {
          var baofei3 = "50000";
        }
        if (this.radio6 == "6") {
          var baofei3 = "60000";
        }
        if (this.radio6 == "7") {
          var baofei3 = "700000";
        }
        if (this.radio6 == "8") {
          var baofei3 = "800000";
        }
        if (this.radio6 == "9") {
          var baofei3 = "900000";
        }
        if (this.radio6 == "10") {
          var baofei3 = "1000000";
        }
        this.shangyeList.push({
          kindCode: "030009",
          sumInsured: baofei3,
          quantity: "",
          unitInsured: baofei3,
          rate: "",
          deductible: "",
          amt: baofei3,
          relatedInd: c6369003,
          glassType: null
        });
      }

      if (this.radio7 == "1") {
        this.shangyeList.push({
          kindCode: "030061",
          sumInsured: "",
          quantity: "",
          unitInsured: "",
          rate: "",
          deductible: "",
          amt: "",
          relatedInd: "",
          glassType: null
        });
      } else {
        var baofei4 = "0";
      }

      if (this.radio8 == "1") {
        var glassType = "303011001";
        var baofei5 = "";
        this.shangyeList.push({
          kindCode: "030004",
          sumInsured: baofei5,
          quantity: "",
          unitInsured: baofei5,
          rate: "",
          deductible: "",
          amt: baofei5,
          relatedInd: "",
          glassType: glassType
        });
      } else if (this.radio8 == "2") {
        var glassType = "303011002";
        var baofei5 = "";
        this.shangyeList.push({
          kindCode: "030004",
          sumInsured: baofei5,
          quantity: "",
          unitInsured: baofei5,
          rate: "",
          deductible: "",
          amt: baofei5,
          relatedInd: "",
          glassType: glassType
        });
      } else {
        var glassType = "";
        var baofei5 = "";
      }

      if (this.checkbox9 == true) {
        var c9369003 = "369003";
      } else {
        var c9369003 = "";
      }
      if (this.radio9 == "1") {
        var baofei6 = "2000";
        this.shangyeList.push({
          kindCode: "032601",
          sumInsured: baofei6,
          quantity: "",
          unitInsured: baofei6,
          rate: "",
          deductible: "",
          amt: baofei6,
          relatedInd: c9369003,
          glassType: null
        });
      } else if (this.radio9 == "2") {
        var baofei6 = "5000";
        this.shangyeList.push({
          kindCode: "032601",
          sumInsured: baofei6,
          quantity: "",
          unitInsured: baofei6,
          rate: "",
          deductible: "",
          amt: baofei6,
          relatedInd: "",
          glassType: null
        });
      } else {
        var baofei6 = "0";
      }

      //
      if (this.checkbox10 == true) {
        var c10369003 = "369003";
      } else {
        var c10369003 = "";
      }
      if (this.radio10 == "1") {
        this.shangyeList.push({
          kindCode: "030012",
          sumInsured: "",
          quantity: "",
          unitInsured: "",
          rate: "",
          deductible: "",
          amt: "",
          relatedInd: c10369003,
          glassType: null
        });
      }

      if (this.radio11 == "1") {
        this.shangyeList.push({
          kindCode: "033601",
          sumInsured: "",
          quantity: "",
          unitInsured: "",
          rate: "",
          deductible: "",
          amt: "",
          relatedInd: "",
          glassType: null
        });
      }

      if (this.radio12 == "1") {
        this.shangyeList.push({
          kindCode: "032618",
          sumInsured: "",
          quantity: "",
          unitInsured: "",
          rate: "",
          deductible: "",
          amt: "",
          relatedInd: "",
          glassType: null
        });
      }
      console.log(baofei);
      // return
      this.post(
        {
          merchantName: "taishan",
          functionName: "QuotedPrice",
          //车主信息
          carOwnerInfo: {
            birthday: this.ownerBirthDay,
            sex: "",
            address: this.Address,
            email: "",
            customerType: "",
            identifyNumber: this.identifyNumber,
            mobile: this.mobilePhone,
            ownerName: this.ownerName,
            age: 18,
            identifyType: "01",
            licenseDate: this.licenseDate,
            insuredType: 1
          },
          //投保人信息
          insureInfo: {
            birthday: this.insureBirthday,
            sex: "",
            address: this.insureAddress,
            email: "",
            customerType: "",
            identifyNumber: this.insureIdNum,
            mobile: this.insurePhone,
            ownerName: this.insureName,
            age: 18,
            identifyType: "01",
            licenseDate: this.licenseDate,
            insuredType: 1
          },
          //被投保人信息
          applyInfo: {
            birthday: this.insuredBirthday,
            sex: "",
            address: this.insuredAddress,
            email: "",
            customerType: "",
            identifyNumber: this.insuredIdNum,
            mobile: this.insuredPhone,
            ownerName: this.insuredName,
            age: 18,
            identifyType: "01",
            licenseDate: this.licenseDate,
            insuredType: 1
          },
          riskMainInfo: {
            cityName: "130200",
            citycode: "130200",
            guaranteeSlipType: carInfoSource,
            // startTimeMtpl: this.jishidate + " " + this.jishiHour + ":00",
            // endTimeMtpl: this.endDate + " " + this.endHour + ":00",
            // startTimeMotor: this.jishidate + " " + this.jishiHour + ":00",
            // endTimeMotor: this.endDate + " " + this.endHour + ":00",
            
            startTimeMtpl:this.shangDate+''+' 00:00:00',
            endTimeMtpl: this.endDate1+''+' 00:00:00',
            startTimeMotor: this.jiaoDate+''+' 00:00:00',
            endTimeMotor: this.endDate2 +''+' 00:00:00',

            ownerUserCode: "580119",
            ownerComCode: "0307001102",
            handlerCode: "710767",
            makeCom: "0307",
            proposalNoMotor: "",
            proposalNoMtpl: ""
          },
          // 车标信息
          carInfo: {
            enrollDate: this.licenseDate,
            frameNo: this.frameNo,
            engineNo: this.engineNo,
            licenseNo: this.licenseNo,
            chgOwnerFlag: this.chgOwnerFlag,
            transferDate: "",
            LocalModelCode: this.carModelId
          },
          itemKindInfoList: this.shangyeList
        },

        "api/services/app/car/QuotedPrice"
      ).then(res => {
        
        // return
        if (res.data.success == true) {
          if (res.data.result.insuranceCode == 0) {
            var storage = window.localStorage;
            var baseInfo = res.data.result.baseinfo;
            var businessRiskInfo =res.data.result.businessRiskInfo
            var forceRiskInfo =res.data.result.forceRiskInfo

            storage.setItem("baseInfo", JSON.stringify(baseInfo));
            storage.getItem("baseInfo");
            
            console.log(businessRiskInfo)
            console.log(forceRiskInfo)
            // storage.setItem("baseInfoDto", JSON.stringify(baseInfoDto));
            // storage.getItem("baseInfoDto");
            console.log(storage.getItem("baseInfo"));
            // console.log(res.data.data.submitCoreInfo.retCode)
            // axios
            //   .post(
            //     "/api/ebusiness/intefPropertyInsuranceServlet?actionType=operateOrder",
            //     {
            //       baseInfo
            //     }
            //   )
            //   .then(res => {
            //     console.log(res.data);
            //   });
            // console.log(baofeiNum);
            //总保费
            //   baofeiNum.insuredInfo.totalPremium


            // if (baofeiNum.businessRiskInfoDto != null) {
            //   var businessPremium =
            //     baofeiNum.businessRiskInfoDto.businessPremium;
            // } else {
            //   var businessPremium = 0;
            // }

            // if (baofeiNum.forceRiskInfoDto != null) {
            //   var forcePremium = baofeiNum.forceRiskInfoDto.forcePremium;
            //   var sumPayTax =
            //     baofeiNum.forceRiskInfoDto.carShipTaxInfo.sumPayTax;
            // } else {
            //   var forcePremium = 0;
            //   var sumPayTax = 0;
            // }
            

      
            this.$router.push({
              name: "CarBaojia",
              query: {
                licenseNo: this.licenseNo,
                licenseDate: this.licenseDate,
                frameNo: this.frameNo,
                engineNo: this.engineNo,
                value: this.value,

                //总保费
                totalPremium:  baseInfo.totalPremium,
                //商业险总保费
                businessPremium: businessRiskInfo.businessPremium,
                //交强险总保费
                forcePremium: forceRiskInfo.basePremium,
                // sumPayTax: sumPayTax
              }
            });
          } else {
            Dialog.alert({
              title: "提示",
              message: res.data.result.insuranceMsg
            }).then(() => {
              // on close
            });
          }
          // console.log(111);

          // var str = res.data.message;
          // str = str.match(/投保单号为：(\S*)，/)[1];
          // console.log(str); //结果bbbcccdddeee
          // this.zanCun.push("1");
          // this.touNum = str;
        } else {
          Toast("请求超时，请稍后再试");
        }
      });
    },
    getDaHo: function() {
      this.jishidate = this.formatDate(new Date());
      this.jishiHour = this.formatHour(new Date());
    },

    /* eslint-disable */ 
    //格式时间
    formatDate: function(time) {
      var date = new Date(time);

      var year = date.getFullYear(),
        month = date.getMonth() + 1, //月份是从0开始的
        day = date.getDate(),
        hour = date.getHours(),
        min = date.getMinutes(),
        sec = date.getSeconds();
      var newTime =
        year +
        "-" +
        (month < 10 ? "0" + month : month) +
        "-" +
        (day < 10 ? "0" + day : day);

      return newTime;
    },
    //获取年份
    formatYear: function(time) {
      var date = new Date(time);

      var year = date.getFullYear() + 1,
        month = date.getMonth() + 1, //月份是从0开始的
        day = date.getDate();

      var newTime =
        year +
        "-" +
        (month < 10 ? "0" + month : month) +
        "-" +
        (day < 10 ? "0" + day : day);

      return newTime;
    },
    //获取天数
    formatDay: function(time) {
      var date = new Date(time);

      var day3 = new Date();
      day3.setTime(day3.getTime() + 24 * 60 * 60 * 1000);
      var s3 =
        day3.getFullYear() + "-" + (day3.getMonth() + 1) + "-" + day3.getDate();

      return s3;
    },
    //获取小时
    formatHour: function(time) {
      var date = new Date(time);

      var hour = date.getHours();
      return hour + 2 + ":00";
    },
    showPo1: function(type) {
      if (type == 1) {
        this.show = true;
      } else if (type == 2) {
        this.show2 = true;
      } else if (type == 3) {
        this.show3 = true;
      } else if (type == 4) {
        this.show4 = true;
      } else if (type == 5) {
        this.show5 = true;
      } else if (type == 6) {
        this.show6 = true;
      } else if (type == 7) {
        this.show7 = true;
      } else if (type == 8) {
        this.show8 = true;
      } else if (type == 9) {
        this.show9 = true;
      } else if (type == 10) {
        this.show10 = true;
      } else if (type == 11) {
        this.show11 = true;
      } else if (type == 12) {
        this.show12 = true;
      }
    },
    closePop: function(type) {
      if (type == 1) {
        this.show = false;
      } else if (type == 2) {
        this.show2 = false;
      } else if (type == 3) {
        this.show3 = false;
      } else if (type == 4) {
        this.show4 = false;
      } else if (type == 5) {
        this.show5 = false;
      } else if (type == 6) {
        this.show6 = false;
      } else if (type == 7) {
        this.show7 = false;
      } else if (type == 8) {
        this.show8 = false;
      } else if (type == 9) {
        this.show9 = false;
      } else if (type == 10) {
        this.show10 = false;
      } else if (type == 11) {
        this.show11 = false;
      } else if (type == 12) {
        this.show12 = false;
      }
    },

    mianpei: function(type) {
      if (type == 3) {
        this.checkbox3 = !this.checkbox3;
      }
      if (type == 4) {
        this.checkbox4 = !this.checkbox4;
      }
      if (type == 5) {
        this.checkbox5 = !this.checkbox5;
      }
      if (type == 6) {
        this.checkbox6 = !this.checkbox6;
      }

      if (type == 9) {
        this.checkbox9 = !this.checkbox9;
      }
      if (type == 10) {
        this.checkbox10 = !this.checkbox10;
      }
    }
  }
};
</script>
<style scoped lang="scss">
.swich {
  position: absolute;
  top: 0.27rem;
  right: 0.4rem;
  span {
    position: relative;
    top: -0.18rem;
    font-size: 0.3rem;
    color: rgba(0, 0, 0, 0.5);
  }
}
.van-cell {
  font-size: 13px !important;
}
#zzz {
  .van-icon {
    font-size: 12px;
    color: transparent;
    text-align: center;
    line-height: inherit;
    border: 1px solid #aaa;
    width: 16px;
    height: 16px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
}
.pop {
  width: 6rem;
  padding: 0.5rem;
  .van-radio {
    padding: 0.2rem 0;
  }
  .popMs {
    // top: 5px;
    position: relative;
    font-size: 14px;
  }
  .van-radio__input {
    // height: 1em;
    position: relative;
    font-size: 20px;
    top: -0.16rem;
  }
}
.btnCon {
  width: 10rem;
  position: fixed;
  bottom: 0;
  background: #fff;
}
.cell_title {
  display: inline-block;
  width: 3rem;
}
.P_title {
  margin-bottom: 0.2rem;
}
.ani_h {
  transition: all 0.3s;
  -moz-transition: all 0.3s; /* Firefox 4 */
  -webkit-transition: all 0.3s; /* Safari 和 Chrome */
  -o-transition: all 0.3s; /* Opera */

  overflow: hidden;
  .shangye_child {
    padding: 0.2rem;
    text-align: left;
    background: #fff;
    color: rgb(153, 153, 153);
  }
  .mianpei {
    color: #999999;
    border: 1px solid #999999;
    border-radius: 5px;
    position: absolute;
    left: 5.5rem;
    padding: 0px 5px;
  }
  .active_m {
    color: #06bf04;
    border: 1px solid #06bf04;
  }
  .c_de {
    margin-top: 0.2rem;
  }
}
</style>
